/// 返回值定义
type BT_IN_PROGRESS=0;
type BT_SUCCESSED=1;
type BT_FAILED=-1;
type BT_ABORTED=-2
type BT_BEHAVIOR_CODE=BT_IN_PROGRESS|BT_SUCCESSED|BT_FAILED|BT_ABORTED;

declare const BT_IN_PROGRESS: BT_IN_PROGRESS;
declare const BT_SUCCESSED: BT_SUCCESSED;
declare const BT_FAILED: BT_FAILED;
declare const BT_ABORTED: BT_ABORTED;

/// 索引值定义
type BT_ReturnToParent=-2;
type BT_NotInitialized=-1;
declare const BT_ReturnToParent: BT_ReturnToParent;
declare const BT_NotInitialized: BT_NotInitialized;

/**
 * 组合节点执行参数
 */
interface IBehaviorTreeSearchData<T>
{
    owner:T;
    currentChild:number;// 当前正在执行的child索引
}

/**
 * 组合节点返回值
 */
interface ICompositeReturn 
{
    index:number
    lastResult:BT_BEHAVIOR_CODE
}

/**
 * 组合节点的内存对象
 */
interface IBTCompositeMemory
{
    /** index of currently active child node */
    currentChild:number;
	/** child override for next selection */
	overrideChild:number;
}

interface IBTParallelMemory extends IBTCompositeMemory
{
    /** 主任务的返回值*/
    mainTaskResult:BT_BEHAVIOR_CODE;
	/** try running background tree task even if main task has finished */
    bForceBackgroundTree :number;
}


interface IGameEntity
{
    // getNodeMemory<T>():T
}


/* 
1.conditionNode SreviceNode BlackNode都是 DecorateNode
2.abort 终止本装饰器的父对象 parent ， Both:  parent的节点，以及parent低优先级的节点  self: 只终止parent   LowerPriority:低优先级的
*/